class Solution(object):
    def isUgly(self, n):
        """
        :type n: int
        :rtype: bool
        """
        if n <= 1:
            return False
        while n >= 2:
            if n % 2 == 0:
                n = n // 2
            else:
                if n % 3 == 0:
                    n = n // 3
                else:
                    if n % 5 == 0:
                        n = n // 5
                    else:
                        return False
        return True
